#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <stdint.h>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTimer>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>
#include <QtCharts/QValueAxis>
#include <QtCharts/QSplineSeries>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    uint8_t get_open_flag();
    void set_open_flat(uint8_t data);


private:
    Ui::MainWindow *ui;
    QSerialPort *serial;
    QTimer *timer;
    uint8_t open_flag;
    uint64_t x_index;

    /*******************/
    QValueAxis *axisX;
    QValueAxis *axisY;
    QLineSeries *series1;
    QLineSeries *series2;
    QChart *chart;
public slots:
    void openserial();
    void checkserial();
    void time_out();
    void textclear();
};
#endif // MAINWINDOW_H
